Amazon | SDE1 | Banglore | Jan 2022 Offer

26/9/2022 17:1 - Asia/Calcutta

Applied through Amazon jobs portal.
Number of rounds – 5
Overall time taken –1.5 month.
YOE - 1.5 year

Round 1 – Online Assessment (First week of December, 2021)

Q1: Prime Orders

Given a List of Orders , where each Order is a string . For example : [aax 12 23 ] [ ff kindle ebook] are two orders. Each order has an ID which is first part of the order ( ID of order 1 = aax , ID2 = ff ). The remaining part of the order is referred to as MetaData. There are two types of orders, Prime orders ( which contain non numeric Meta Data) and Non-Prime Orders (which contain Only-Numeric Meta Data). Sort the List of Orders as given below :
a. Prime Orders before NonPrime Orders
b. Prime Order with lexicographically smaller MetaData comes first.
c. In Case of tie in (b) , the one with lexicographically smaller ID comes first.
d. The relative order of NonPrime Orders remains the same.

Passed all test case.

Q2: Amazon Popularity

A combo is defined as a subset of the given n terms. The total popularity is the sum of the individual items of the combo. design an algorithmn that can find the k combos with the highest popularity.

Two combos are considered different if they have different subset of items. Return the array of k integers where the ith term denotes the popularity of ith best combo. Combos should be returned arranged best to worst.

Note: You can have an empty subset as a combo as well. The popularity for such a subset is 0.

Example
n = 3
popularity= [3, 5, -2]
k = 3

All possible popularities of combos are 0, 3, 5, -2, 8, 3, 1, 6.
The best three combos have popularities 8, 6, and 5. The answer is [8, 6, 5].

Returns

int[k]: the popularities of the best k combos, in decreasing order.

Constraints
1 <= n <= 10^5
-10^9 <= popularity[i] <= 10^9
1 <= k <= min(2000, 2^n)

Passed 11/15 test case.

Orginally Interviews were scheduled for 3rd week of December but got postponed due to year end. Therefore, it happened during the second week of January

Round 2 – 1st Technical Round

  • Short Introduction

  • Remove nodes on root to leaf paths whose length < K
    Hard level problem

  • Largest Area in Histogram.
    Hard level problem
    Explained: Brute{ O(n)² } -> Better{ 3 pass O(n) } -> Optimal{ 1 pass O(n) }

  • LP.

Round 3 – 2nd Technical Round

  • Short Introduction

  • Find the Next Greater Element in an array.
    Medium level problem
    First solve with Brute force approach. Then optimize it with Stack taking O(n) space.

  • Convert a Ternary Expression string to a Binary Tree.
    Here you can have a string instead of char between the ternary operators.
    Hard level problem

    Input :  ab ? bcd : efgh
    
    Output
                   ab
      	          /  \
      		   bcd    efgh
    
  • LP.

Round 4 – Hiring Manager Round

  • Introduction

  • Convert 1 into N in minimum steps by multiplying with 2 or by adding 1.

    Input: 19;  Output: 6
    

    Medium level problem
    Explained: Recursion -> DP -> Better{ O(n) } -> Optimal{ O(log(n)} }

    After that question was updated with if you are only allowed to multiply by 2, K times.
    Explained: Optimal{ O(logK) }

  • LP and Behaviour: Took a different approach where I asked permission for presenting myself, then through my presentation only all his/her questions were answered automatically.

Round 5 – Bar Raiser Round

  • Introduction

  • It contained Leadership - Behaviour - Situtation based questions. (Can't remember exactly, as it was more of a conversation rather than a typical QA round)

Verdict – Selected.

Comments

Submit
0 Comments